<?php
namespace frontend\models;
header("content-type:text/html;charset=utf-8");



use yii\base\Model;
use yii\web\UploadedFile;


class Upload_img extends Model{

    public $resume_img; //个人用户的 头像

    public function rules(){
        return[
            [ ['resume_img'], 'file', 'skipOnEmpty'=>false, 'extensions'=>'png,jpg,gif' ],
        ];
    }


    public function upload(){

        if( $this->validate()){
            $resume_img = 'upload/' . $this->resume_img->baseName . '.' . $this->resume_img->extension ;
            $this->resume_img->saveAs($resume_img);
            return $resume_img;

        }else{
            return false;
        }
    }

}






















